#ifndef LIT__EDITOR__DIALOG_RETURN_HH__
#define LIT__EDITOR__DIALOG_RETURN_HH__

#include <unordered_map>
#include <string>
#include <qdialog.h>

namespace Lit
{
	namespace Editor
	{
		template<typename RetT>
		struct DialogReturn
		{
			typedef QDialog::DialogCode Code;

			DialogReturn( Code cod ){ code=cod; value=""; }
			DialogReturn( Code cod, const RetT &val ){ code=cod; value=val; }
			DialogReturn( const DialogReturn& r ){ code=r.code; value = r.value; }
			DialogReturn& operator=( const DialogReturn& r ){ code=r.code; value = r.value; return *this; }
			DialogReturn(){}
			virtual ~DialogReturn(){}
				
			bool accepted() const{ return (code == QDialog::Accepted); }
			bool rejected() const{ return (code == QDialog::Rejected); }

			Code						code;
			RetT						value;
		};
		template<typename firstType, typename secondType>
		struct DialogMapReturn : public DialogReturn<std::unordered_map<firstType,secondType> >
		{
			typename typedef firstType FirstType;
			typename typedef secondType SecondType;
			typename typedef std::unordered_map<firstType, secondType> MapType;
				
			DialogMapReturn( Code cod ) : DialogReturn<std::unordered_map<firstType,secondType>>( cod ){}
			DialogMapReturn( Code cod, const MapType& val ) : DialogReturn<std::unordered_map<firstType,secondType>>( cod, val ){}
			DialogMapReturn( const DialogMapReturn& r ) : DialogReturn<std::unordered_map<firstType,secondType>>( r ){}
			DialogMapReturn(){}
			~DialogMapReturn(){}
		};
			
		typedef DialogReturn<std::string> StringReturn;
		typedef DialogMapReturn<std::string, std::string> StringMapReturn;
	};
};
#endif